home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.4 Applications 1997 August / SGI IRIX 6.4 Applications 1997 August.iso / dist / insight.idb / usr / share / Insight / xhelp / HELPDEV.txt.z / HELPDEV.txt
Encoding:
Text File  |  1997-07-30  |  41.3 KB  |  1,090 lines

  1.  
  2. Table of Contents
  3. -----------------
  4. * Overview
  5. * Integrating sgihelp Into Your Application
  6. * Including the Header File and Linking with the Library
  7. * Understanding Available Calls
  8.     Initializing Communication
  9.     Making a Request from Within an Application
  10.     Invoking the Index Window for the Application
  11. * Constructing a Help Menu: A Suggested Structure
  12. * Enabling Help From an Application Pushbutton
  13. * Providing Context-Sensitive Help within an Application
  14. * A Sample Application
  15. * Overview of the Application Helpmap File
  16. * Explanation of the Application Helpmap File
  17. * Adding Widget Hierarchies To the Helpmap File
  18. * Writing the Online Help
  19.     What is SGML?
  20.     What is a DTD?
  21.     Creating the File
  22.     Using the Sample SGML Files    
  23. * Preparing to Build the Online Help
  24. * Building the Online Help
  25. * Finding and Correcting Errors
  26. * Producing the Final Product
  27.  
  28. Overview 
  29. ---------- 
  30.  
  31. Many of Silicon Graphics' desktop applications now provide online
  32. help.  This document describes how to use Silicon Graphics' online help
  33. system, SGIHelp, to deliver the online help for your product. It
  34. describes how to prepare the help and integrate it into your
  35. application.
  36.  
  37. Integrating SGIHelp Into Your Application
  38. -----------------------------------------------------------
  39.  
  40. When you install the package, you receive two files that allow
  41. you to use the SGIHelp system within your application.
  42.  
  43.   File          Description                     Installed In
  44.   ------------- ------------------------------- ---------------------
  45.   HelpBroker.h  Include file for help protocol    /usr/include/helpapi
  46.   libhelpmsg.a  Library file to link app with   /usr/lib
  47.  
  48.         Table 1. Developer Files
  49.  
  50. Both the library and include file were developed in "C", and can
  51. be used with either the C or C++ programming languages.
  52.  
  53. Including the Header File and Linking with the Library
  54. ------------------------------------------------------
  55.  
  56. To include the header file in your application, add the following line
  57. where the SGIHelp API calls will be made:
  58.  
  59.     #include <helpapi/HelpBroker.h>
  60.  
  61. To use the API to communicate with the SGIHelp XHELP
  62. server, you need to link with the library libhelpmsg.a,
  63. installed in /usr/lib. For example, to compile a file "hellohelp.c++"
  64. to produce the executable "hellohelp", you would enter:
  65.  
  66.     CC -o hellohelp hellohelp.c++ -lhelpmsg -lX11
  67.  
  68. Note:    Linking with the library requires that you include
  69.     the X-library, libX11. 
  70.     
  71.  
  72. Understanding Available Calls to Communicate with the Help Server
  73. -----------------------------------------------------------------
  74.  
  75. This section documents the calls to the help server (SGIHelp)
  76. and the values of the parameters. All calls return 1 upon success, and
  77. 0 upon failure. All communication to the help server is based upon
  78. X/ICCCM.
  79.  
  80. There are three available calls. Table 2 briefly describes the
  81. purpose of each call. Below the table, you see more detailed
  82. explanations.
  83.  
  84.   Call            Use
  85.   --------------      --------------------------------------
  86.   SGIHelpInit()        initiates contact with the help server
  87.   SGIHelpMsg()        starts sgihelp and displays a specific help card
  88.   SGIHelpIndexMsg()    opens an Index window that lists all available
  89.             help topics for the application
  90.  
  91.         Table 2. Help Server Commands
  92.  
  93.     Initializing Communication
  94.     --------------------------
  95.  
  96.     To communicate with the help server properly, you must use the call
  97.     SGIHelpInit().  SGIHelpInit() does not start-up or communicate with the
  98.     actual help server process; it does store some important 
  99.     information used for the additional calls described below.
  100.  
  101.     SGIHelpInit(Display *dsp, char *client, char *sep);
  102.  
  103.         dsp      : The structure that serves as the connection to 
  104.                        the X server; result of the XOpenDisplay() call.
  105.  
  106.         client    : The client application classname. Use the
  107.                 name that is used to retrieve the
  108.                 application's app-defaults, and not just an
  109.                 internal object class name (although they
  110.                 could be the same). Same as used by
  111.                 XtAppInitialize().
  112.  
  113.         sep       : Separator character used by the application
  114.                 to separate the widget hierarchy when a context
  115.                 sensitive help request is made. At this time, it
  116.                 is required that you use the character ".".
  117.  
  118.     Sample Code:
  119.         -----------
  120.     #include <X11/Xlib.h>
  121.     #include <helpapi/HelpBroker.h>
  122.  
  123.     void main(int, char**)
  124.     {
  125.             /* default to the value of the DISPLAY environment var */
  126.             Display *display = XOpenDisplay(NULL);
  127.  
  128.             if( display ) {
  129.                 /* initialize the help server */
  130.                 SGIHelpInit(display, "MyApp", ".");
  131.         }
  132.     ...
  133.  
  134.  
  135.     Making a Request from Within an Application:
  136.     -------------------------------------------
  137.  
  138.     If a copy of the help server is not already running,
  139.     SGIHelpIndexMsg() automatically starts the server if 
  140.     the application (sgihelp) is available.
  141.  
  142.     SGIHelpMsg (char *key, char *book, char *user_data);
  143.  
  144.         key       : Tells the help server what information to render.
  145.                 In some cases, this could be the direct key from a
  146.                 help book the application uses, or it
  147.                 could be a widget hierarchy. If a widget
  148.                 hierarchy is passed, the help server looks in
  149.                 the application's helpmap file to find a mapping.
  150.                 If if doesn't find an exact match, it uses a
  151.                 fallback algorithm to determine which is the 
  152.                 "closest" hierarchy found. 
  153.  
  154.                             See "The Application Helpmap File" for more
  155.                             information.
  156.  
  157.         book      : Gives the name of the help "book" that
  158.                 contains the application's help
  159.                 information.  If you set this to NULL or
  160.                 "*", the help server looks in the the
  161.                 application's helpmap file for the book
  162.                 name. In the latter case, a helpmap file
  163.                 must exist.
  164.  
  165.                             See "The Application Helpmap File" for more
  166.                             information.
  167.  
  168.         user_data : Reserved for future use. All applications 
  169.                 should set this field to NULL.
  170.  
  171.         Sample Code:
  172.         -----------
  173.         #include <X11/Xlib.h>
  174.         #include <helpapi/HelpBroker.h>
  175.  
  176.         void main(int, char**)
  177.         {
  178.                 /* assume initialization of help server is complete */
  179.  
  180.         /*
  181.                  * This call will render the section (card) with a key
  182.          * of help_save_button (found in the "HelpId=" field).
  183.          * It will look for this section in the book "MyAppHelp".
  184.          */
  185.         SGIHelpMsg("help_save_button", "MyAppHelp", NULL);
  186.         ...
  187.  
  188.  
  189.     Invoking the Index Window for the Application:
  190.     ---------------------------------------------
  191.  
  192.     This call causes the help server to look for the application's
  193.     helpmap file, and invoke the Help Index window. The index
  194.     presents a listing of all the help topics listed in the helpmap
  195.     file. You must have a helpmap file for this call to work
  196.     properly.
  197.  
  198.         See "The Application Helpmap File" for more information.
  199.  
  200.  
  201.     SGIHelpIndexMsg (char *key, char *book);
  202.  
  203.         key       : Set to NULL or "index".
  204.  
  205.         book       : Reserved for future use. Set to NULL.
  206.  
  207.         Sample Code:
  208.         -----------
  209.         #include <X11/Xlib.h>
  210.         #include <helpapi/HelpBroker.h>
  211.  
  212.         void main(int, char**)
  213.         {
  214.                 /* assume initialization of help server is complete */
  215.  
  216.                 /*
  217.                  * This call will look in the application's helpmap
  218.                  * file for a list of topics to display to the user in
  219.                  * sgihelp's index window.
  220.                  */
  221.                 SGIHelpIndexMsg("index", NULL);
  222.         ...
  223.  
  224.  
  225. o Constructing a Help Menu: A Suggested Structure
  226.   -----------------------------------------------
  227.  
  228. If your application contains a menubar, you can include a Help
  229. pulll-down menu. This section describes a convention used by
  230. applications that are a part of the Indigo Magic User Environment. Note
  231. that these items are derived from the Motif 1.2 Style Guide (class 2).
  232.  
  233. Below you see a sample structure for a Help menu:
  234.  
  235.     Click for Help        Shift+F1
  236.     Overview
  237.     --------------------------------
  238.     "list of topics"
  239.     --------------------------------
  240.     Index
  241.     Keys & Shortcuts
  242.     --------------------------------
  243.     Product Information
  244.  
  245.  
  246. "Click for Help"        Provides context-sensitive help. When a user
  247.             chooses "Click for Help," the cursor turns into
  248.             a "?". The user can move the cursor over an
  249.             item/area of interest and click.  Clicking the
  250.             mouse button initiates communication with the
  251.             help server; SGIHelp displays a help card. 
  252.  
  253.             You, the developer, are responsible for writing
  254.             code that tracks the cursor and  interrogates
  255.             the widget hierarchy.  Somewhere, you need to
  256.             make a mapping between what the user has
  257.             clicked on, and the help card that's
  258.             displayed.  One option is to provide the
  259.             mapping via the application helpmap file. See
  260.             "The Application's Helpmap File." Another
  261.             possibility is to use the "HelpId=" attribute
  262.             in the help text.
  263.  
  264. "Overview"         Provides an overview of the window or application.
  265.  
  266. "list of topics"        Presents a list of task-oriented help topics
  267.             that can be added to the menu. The entries can
  268.             be listed in the application's defaults file,
  269.             with a menu item/help_key structure, or can be
  270.             read directly from the application's helpmap
  271.             file.
  272.  
  273. "Index"                 Displays a list of help topics for the
  274.             application. You must have an application
  275.             helpmap file if you use the call
  276.             SGIHelpIndexMsg().
  277.  
  278. "Keys & Shortcuts"     Displays a help card that contains the application's
  279.             accelerator keys, keyboard shortcuts, etc...
  280.  
  281. "Product Information"   Produces a dialog box showing the name, version
  282.             and any copyright information or other related data
  283.             for this application.
  284.  
  285.  
  286.  
  287. o Enabling Help From an Application Pushbutton
  288.   --------------------------------------------
  289.  
  290. If your application doesn't contain a menubar, you can provide a Help
  291. button. This code sample displays how you can use the SGIHelp API
  292. to communicate with the sgihelp server from a pushbutton within your
  293. application.
  294.  
  295.         Sample Code:
  296.         -----------
  297.     /* required include file for direct communication with help server 
  298.         #include <helpapi/HelpBroker.h>
  299.         #include <X11/Xlib.h>
  300.  
  301.     ...
  302.  
  303.     /* initialize help server information */
  304.         SGIHelpInit(display, "MyWindowApp", ".");
  305.  
  306.     ...
  307.  
  308.     /* create help pushbutton for your window */
  309.     Widget helpB = XmCreatePushButton(parent, "helpB", NULL, 0);
  310.       XtManageChild(helpB);
  311.  
  312.       XtAddCallback(helpB, XmNactivateCallback,
  313.               (XtCallbackProc)helpCB, (XtPointer)NULL);
  314.     ... 
  315.  
  316.     /* help callback */
  317.     void helpCB(Widget w, XtPointer clientData, XtPointer callData) 
  318.     {
  319.         /* 
  320.                  * communicate with the help server; developer
  321.                  * may wish to pass the "key" in as part of the
  322.          * callback's callData parameter...
  323.                  */
  324.         SGIHelpMsg("key", "book", NULL);    
  325.     }
  326.  
  327.  
  328. The "key" is described in "Available Calls to Communicate with the Help
  329. Server." It's found within the "book" that contains the application's
  330. help text, or in the application's helpmap file. The helpmap file
  331. provides a "level of indirection" between the help content and your
  332. code.
  333.  
  334. Sending this "key" to the help server causes the server to render the 
  335. card that contains the "key" as it's "HelpId=" attribute.
  336.  
  337. o Providing Context-Sensitive Help within an Application
  338.   ------------------------------------------------------
  339.  
  340. You may want to provide context sensitive help from within your
  341. application. To do so, you need to write code that tracks the cursor
  342. and interrogates the widget hierarchy.  Additionally, you need to make a
  343. mapping between what the user has clicked on, and the help card that's
  344. displayed.  One option is to provide the mapping via the application
  345. helpmap file. See "The Application's Helpmap File." Another possibility
  346. is to use the "HelpId=" attribute in the help text.
  347.  
  348. This code sample assumes you are using X/Motif, and is
  349. provided as an example. Note that some areas, such as menu creation,
  350. are missing. See XmTrackingLocate(3X) for further information.
  351.  
  352.         Sample Code:
  353.         -----------
  354.     /* required include file for direct communication with help server 
  355.         #include <helpapi/HelpBroker.h>
  356.  
  357.     ...
  358.  
  359.     /* create menu; set menu to be the "help menu" for this window */
  360.     createHelpMenu();
  361.     XtVaSetValues(parent, XmNmenuHelpWidget, _helpMenuPaneWidget, NULL);
  362.  
  363.     ...
  364.  
  365.     /* add callback for menu item that triggers context-sensitive mode */
  366.     XtAddCallback(helpOnContextWidget, XmNactivateCallback,
  367.                       (XtCallbackProc)onContextCB, (XtPointer)NULL);
  368.     ...
  369.  
  370.     void onContextCB(Widget wid, XtPointer clientData, XtPointer callData)
  371.     {
  372.             static Cursor cursor = NULL;
  373.         static char path[MAX_STR], tmp[MAX_STR];
  374.             Widget shell, w, result;
  375.    
  376.         strcpy(path, "");
  377.                 strcpy(tmp,  "");
  378.  
  379.         /* create a question-mark cursor */
  380.             if(!cursor)
  381.                  cursor = XCreateFontCursor(display, XC_question_arrow);
  382.  
  383.             XmUpdateDisplay(mainWindowWidget);
  384.  
  385.         /* get the top-level shell for the window */
  386.             shell = mainWindowWidget;
  387.             while (shell && !XtIsShell(shell)) {
  388.                   shell = XtParent(shell);
  389.             }
  390.  
  391.         /* 
  392.          * modal interface for selection of a component;
  393.          * returns the widget or gadget that contains the pointer
  394.          */
  395.             result = XmTrackingLocate(shell, cursor, FALSE);
  396.  
  397.             if( result ) {
  398.                 w = result;
  399.  
  400.                 /* get the widget hierarchy; separate with a '.';
  401.                          * this also puts them in top-down vs bottom-up order.
  402.              */
  403.                 do {
  404.                 if( XtName(w) ) {
  405.                               strcpy(path, XtName(w));
  406.  
  407.                               if( strlen(tmp) > 0 ) {
  408.                                       strcat(path, ".");
  409.                                       strcat(path, tmp);
  410.                               }
  411.  
  412.                               strcpy(tmp, path);
  413.                           }
  414.  
  415.                           w = XtParent(w);
  416.                  } while (w != NULL && w != shell);
  417.  
  418.  
  419.                /* 
  420.             *  send msg to the help server-widget hierarchy;
  421.             *  OR 
  422.                         *  provide a mapping to produce the key to be used
  423.             */ 
  424.             if( strlen(path) > 0 )
  425.                 SGIHelpMsg(path, "MyAppBook", NULL);
  426.             }
  427.     }
  428.  
  429.  
  430.  
  431.  
  432. o A Sample Application
  433.   --------------------
  434.  
  435. Below you see a simple command-line program that accepts parameters and
  436. passes them on to the help server. We created this program to test the
  437. SGIHelp server; however, it could probably be used (with some
  438. modifications) to provide a true shell/Unix command help facility.
  439.  
  440.         Sample Code (helpcmd.c):
  441.         -----------------------
  442.     #include <X11/Xlib.h>
  443.     #include <getopt.h>
  444.     #include <ctype.h>
  445.     #include <string.h>
  446.  
  447.     extern char *optarg;
  448.     extern int  optind,opterr;
  449.     static void usage();
  450.  
  451.     /* required include file for direct communication with help server 
  452.     #include <helpapi/HelpBroker.h>
  453.  
  454.     void main ( int argc, char **argv )
  455.     {
  456.             Display *display;
  457.             int c,c2,i;
  458.             char app[80], cmd[80], bk[80], key[1024];
  459.  
  460.             /* set defaults */
  461.             strcpy(app, "");
  462.             strcpy(key, "");
  463.             strcpy(bk,  "*");
  464.             strcpy(cmd, "view");
  465.  
  466.         /* user needs to specify something */
  467.             if (argc <= 1) {
  468.                 usage();
  469.             exit(0);
  470.         }
  471.  
  472.             /* default to the value of the DISPLAY environment var */
  473.             display = XOpenDisplay(NULL);
  474.  
  475.             while ((c = getopt(argc,argv,"a:k:b:c:h")) != -1) {
  476.                     switch (c) {
  477.                         case 'a':
  478.                 /* app; will use helpmap if available */
  479.                                 strcpy(app, optarg);
  480.                                 break;
  481.                         case 'k':
  482.                 /* help key; from "HelpId=" attribute */
  483.                                 strcpy(key, optarg);
  484.                                 break;
  485.                         case 'b':
  486.                 /* book containing help text */
  487.                                 strcpy(bk, optarg);
  488.                                 break;
  489.                         case 'c':
  490.                 /* render a card, or display index */
  491.                                 strcpy(cmd, optarg);
  492.  
  493.                                 /* convert command string to lower-case*/
  494.                                 for(i=0; i<strlen(cmd); i++) {
  495.                                        c2=tolower(cmd[i]);
  496.                                        cmd[i] = c2;
  497.                                 }
  498.  
  499.                                 if( strcmp(cmd, "view")  != 0 &&
  500.                                     strcmp(cmd, "index") != 0 ) {
  501.                                        usage();
  502.                                        exit(1);
  503.                                 }
  504.                                 break;
  505.                         case 'h':
  506.                         default:
  507.                                 usage();
  508.                                 exit(0);
  509.                                 break;
  510.                     }
  511.             }
  512.  
  513.             /* initialize help and send a msg */
  514.             SGIHelpInit(display, app, ".");
  515.  
  516.             if( strcmp(cmd, "view") == 0 )
  517.                     SGIHelpMsg(key, bk, NULL);
  518.             else
  519.                     SGIHelpIndexMsg(app, NULL);
  520.  
  521.         /* cleanup */
  522.             XCloseDisplay(display);
  523.             exit(0);
  524.     }
  525.  
  526.  
  527.     static void usage()
  528.     {
  529.      printf("\nhelpcmd -a [app_classname] -k [key] -c [cmd] -b [book]\n");
  530.      printf("\nwhere:\n\t- app_classname\n");
  531.      printf("\t- key is the key for the card you wish to display\n");
  532.      printf("\t- cmd is either \"view\" or \"index\"\n");
  533.          printf("\t- book is the help book to use\n");
  534.     }
  535.  
  536.  
  537.  
  538. o Overview of the Application Helpmap File
  539.   ----------------------------------------
  540.  
  541. Providing a helpmap file is not essential; it is recommended, however,
  542. especially if you're planning to provide context-sensitive help for
  543. your application.  You can use the helpmap file to:
  544.  
  545.   * generate the list of items you want to appear in the Help index for your 
  546.     application.
  547.  
  548.   * construct the "list of topics" for the Help menu. (See "Constructing a
  549.     Help Menu: A Suggested Structure" for details on the list of
  550.     topics.) To get this behavior, you need to write code
  551.     that parses the helpmap file and extracts these entries.
  552.  
  553.   * provide a level of indirection between the help content and your
  554.     code. Rather than embedding the mapping scheme within your
  555.     application's code, you can place the mapping in the helpmap file. The
  556.     SGIHelp help server accesses the helpmap file directly.
  557.  
  558. For example, you can implement context-sensitive help, and pass in the
  559. concatenated widget hierarchy as the "key" parameter of the
  560. SGIHelpMsg() API call. When the SGIHelp process receives the widget
  561. string, it examines the application's helpmap file, reading in all
  562. mappings that have been provided. It parses the strings, and looks for
  563. an "exact" match.  If it finds a match, it uses the "book" name (field
  564. 2 in the helpmap file) and "key" (field 5 in the helpmap file) to find
  565. and display the correct topic. If it doesn't find an "exact" match, it
  566. uses a fallback algorithm to find the "closest" match.
  567.  
  568. Here's an example of how the fallback algorithm works. Suppose your
  569. application includes a row or set of buttons. When the user asks for
  570. help on a button, you pass that widget string to SGIHelp. If the widget
  571. string is *not* found in the mappings, the last widget is dropped off
  572. the string (in this case, the widget ID for the button itself). The new
  573. string is compared to all available mappings. This loop continues until
  574. *something* is found. At the very least, you should fall back to an
  575. "Overview" card.
  576.  
  577. o Explanation of the Application Helpmap File
  578.   -------------------------------------------
  579.  
  580. This section describes the format and naming convention for the helpmap file.
  581. It begins with a table, and ends with a description of each field in the 
  582. helpmap file.
  583.  
  584.   Item        Description
  585.   -------    -----------------------------------------------------------
  586.   Format    plain ASCII text
  587.  
  588.   Name          the application class name, (which is passed as part of
  589.              the SGIHelpInit() call)followed the the extension
  590.         ".helpmap". For example, if the application class name
  591.         is "MyApp," the helpmap file should be named "MyApp.helpmap."
  592.  
  593.   Installed in    /usr/share/help    
  594.  
  595.         Table 3. Helpmap conventions.
  596.  
  597. Each line in the helpmap file contains six fields. The fields are
  598. separated by semi-colons. Below is a sample entry in a helpmap
  599. file, and a description of the fields. 
  600.  
  601. Entries in a helpmap file will be referred to as "help topic"'s
  602. in the following discussion. All fields are REQUIRED for each 
  603. help topic. If a field does not have an entry for the title (see
  604. below), then set it to a blank space, " ".
  605.  
  606.  
  607.     Sample entry from /usr/share/help/Fm.helpmap:
  608.     --------------------------------------------
  609.  
  610.     0;IRISEssentials;The Find an Icon Window;0;fetch_help;Fm.Fetch
  611.         ^ ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^ ^ ^^^^^^^^^^ ^^^^^^^^
  612.         1       2                   3            4     5         6
  613.  
  614.  
  615.     Description of Fields:
  616.     ---------------------
  617.  
  618.     1     A number that indicates what type of help topic it is.
  619.  
  620.                 0 - a context-sensitive point
  621.                 1 - the Overview card for the application
  622.                 2 - a Task-oriented entry that could show up in a Help menu
  623.                 3 - the card that talks about Keys and Shortcuts
  624.                 4 - reserved for future use
  625.  
  626.         You can use these settings to construct a potential "list
  627.         of topics" within a Help menu. See "A Suggested
  628.         Application Help Menu Structure".
  629.  
  630.         You can also use these numbers to determine which menu
  631.         items should be inactive (grayed-out). For example,
  632.         suppose the Help menu contains an entry for "Keys and
  633.         Shortcuts", but there is no entry in the application
  634.         helpmap file of type "3". You should dynamically omit
  635.         that menu item, OR make that item inactive (grayed).
  636.  
  637.     2       The name of the "book" that contains this help topic.
  638.         Note that help topics can reside in different books.
  639.         Each INDIVIDUAL help topic can point to only one help
  640.         book.
  641.  
  642.         3       The name/title of the help topic. This could appear in a
  643.         Help menu, if you parse the helpmap file to construct
  644.         the "list of topics" on the Help menu.
  645.  
  646.     4       A number that determines whether the topic is a main
  647.         topic or a sub-topic. If all the entries are main
  648.         topics, set the value to "0". To denote a sub-topic,
  649.         set the value to "1". The entry will be a sub-topic of
  650.         the item marked "0" that precedes it in the helpmap
  651.         file.
  652.  
  653.         This produces an expandable/collapsible outline for the
  654.         Help Index window. It can also be used to construct
  655.         a "roll-over" sub-menu as part of a Help menu. To get this
  656.         behavior, you need to parse the helpmap file to construct
  657.         the "list of topics" in the Help menu.
  658.  
  659.         5    The help key, which will be used to render the specific
  660.         card for this help topic. This is the same key found in
  661.         the help book or in the "HelpId=" attribute for the given card.     
  662.  
  663.     6-n     A list of widgets, primarily used for context-sensitive
  664.         help. Note that this field can contain multiple
  665.         entries, all delimited by semi-colons. In this way,
  666.         you can associate different areas with the same 
  667.         help cards/topics.
  668.  
  669.  
  670.  
  671. o Adding Widget Hierarchies To the Helpmap File
  672.   ---------------------------------------------
  673.  
  674. At least *one* widget hierarchy must accompany every point in the
  675. application helpmap file. That one (default) point should be set to
  676. "<application_classname>.<window_classname>". In our example from the
  677. previous section, that happens to be "Fm.Fetch"; where "Fm" is the
  678. application classname, and "Fetch" is the window classname (top-level
  679. shell).
  680.  
  681. Note that the application classname must ALWAYS be the first component
  682. of a widget hierarchy string. All widget id's within the string should
  683. be delimited by a "." (period).
  684.  
  685. Widget hiearchies can be as fine-grained as you wish to make them. A
  686. fall-back algorithm is in place (to go to the closest available
  687. "entry") when the user clicks on a widget in context-sensitive help
  688. mode.
  689.  
  690.  
  691. To get a sample widget hiearchy (help message) from an application, you
  692. can run the SGIHelp help server process in debug mode. Before doing
  693. this, you need to add the SGIHelp API call, SGIHelpMsg(), to your
  694. application and implement context-sensitive help. Make sure that you
  695. send a widget hierarchy string for the "key" parameter in the
  696. SGIHelpMsg() call. (See "Providing Context-Sensitive Help within an
  697. Application" and "Understanding Available Calls" for details on this
  698. call.)
  699.  
  700.  
  701.     Example
  702.     -------
  703.         1) Bring up a shell
  704.  
  705.     2) Make sure the SGIHelp help server process isn't running:
  706.  
  707.                 % /etc/killall sgihelp
  708.  
  709.         
  710.         3) Type the following to make the SGIHelp help server process
  711.            run in the foreground in debug mode:
  712.  
  713.                 % /usr/sbin/sgihelp -f -debug
  714.  
  715.     4) Run your application, and then choose "Click for Help" from
  716.        the help menu. The cursor should change into a "?" (or whatever
  717.        you've implemented for context sensitive help). 
  718.  
  719.     5) Click on a widget, or area of the application.
  720.  
  721.         6) Check the shell from which sgihelp is being run. You should
  722.            see a line such as:
  723.  
  724.  
  725.            REQUEST= client="Overview" command="view" book="" 
  726.                     keyvalue="DesksOverview.MainView.Frame.viewport.Bboard" 
  727.                     separator="." user_data=""
  728.  
  729.        The "keyvalue" field is the one to notice. It contains the
  730.        widget hierarchy that you can add to the helpmap file.
  731.        Remember to add the application classname to the front of
  732.        the string. For our example above, the full widget hierarchy
  733.        string to be added to a helpmap entry would be:
  734.  
  735.         Overview.DesksOverview.MainView.Frame.viewport.Bboard
  736.  
  737. Writing the Online Help
  738. -----------------------
  739. This section describes how you prepare the online help document.
  740. It provides an explanation of the standard format you must use,
  741. as well as the steps you take to actually prepare the file.
  742.  
  743.     What is SGML?
  744.     -------------
  745.  
  746.     SGML stands for Standard Generalized Markup Language. Silicon Graphics
  747.     has adopted SGML as the standard format for its online books and help.
  748.     As such, when you write the online help for your product, you need to
  749.     embed SGML tags. 
  750.  
  751.     See the file /usr/share/Insight/XHELP/samples/sampleDoc/sample.sgm as an
  752.     example. Notice the tags surrounded by angle brackets (<>).
  753.     These tags describe how each item fits into the structure of
  754.     the overall document. For example, a paragraph might be tagged
  755.     as a list item, and a word within that paragraph may be tagged
  756.     as a command.
  757.  
  758.     For a more complete understanding of SGML, see the bibliography at
  759.     the end of this document. It lists several of the many books on SGML.
  760.  
  761.     What Is a DTD?
  762.     --------------
  763.  
  764.     DTD stands for Document Type Definition. It is a text file that
  765.     outlines the tagging rules for your online documentation. In
  766.     other words, it specifies which SGML tags are allowed, and in
  767.     what combination or sequence. 
  768.  
  769.     The file /usr/share/Insight/XHELP/dtd/XHELP.dtd lists the legal
  770.     structure for your online help.
  771.  
  772.     Creating the File
  773.     ------------------
  774.  
  775.     All of the online help for your product is stored in one text file.
  776.     To get started:
  777.  
  778.     1. Create a new directory for the online help; then change to
  779.        this directory.  
  780.     2. Create a text file and name the file TITLE.sgm, where TITLE is one
  781.        word that identifies the online help.
  782.     3. Begin writing the online help.
  783.  
  784.     Using the Sample SGML Files
  785.     ---------------------------
  786.  
  787.     Before beginning to embed the SGML tags, see the file
  788.     /usr/share/Insight/XHELP/samples/sampleDoc/sample.sgm. You can
  789.     model your online help after this example. 
  790.  
  791.     To compare this SGML file to the online help it produces, you
  792.     can build two help files. To do so:
  793.  
  794.     1. Change to a directory in which you want to build the sample
  795.        help book.
  796.     2. Copy the necessary directories and files by typing:
  797.        cp -r /usr/share/Insight/XHELP/samples .
  798.     3. Type: cd samples/sampleDoc
  799.     4. Build the file sample.sgm by typing: make help
  800.        To view this file, type: iiv -b . -v sample
  801.     5. cd ../exampleApp
  802.     6. Build the file exampleAppXmHelp.sgm by typing: make help
  803.     7. To view this file, type: iiv -b . - v exampleAppXmHelp
  804.  
  805. Preparing to Build the Online Help
  806. ----------------------------------
  807.  
  808. The online help must be built, just as a program must be compiled.
  809. When you build the online help, you transform the raw SGML file into a
  810. viewable, online document. To get started, you need to create two
  811. files--a Makefile and a spec file. You use the Makefile to specify the
  812. following:
  813.  
  814.     - the name of file that contains the online help
  815.     - the name you want to assign to the help book 
  816.     - the version number of the product 
  817.  
  818. You use the spec file to define the title of your product, the official
  819. release and version numbers, and other information that is used when
  820. you create the final images.
  821.  
  822. To create these files:
  823.  
  824.     1. Move to the directory that contains the online help file.  
  825.  
  826.     3. Copy /usr/share/Insight/XHELP/templates/Makefile_xhelp by typing:
  827.  
  828.          cp /usr/share/Insight/XHELP/templates/Makefile_xhelp Makefile
  829.  
  830.     4. Copy /usr/share/Insight/XHELP/templates/spec_xhelp by typing:
  831.  
  832.          cp /usr/share/Insight/XHELP/templates/spec_xhelp spec
  833.  
  834.        At this point, the directory should contain two additional
  835.        files: Makefile and spec.
  836.  
  837.     5. Edit the Makefile.
  838.  
  839.       - Next to the label TITLE, type the name of the file that
  840.         contains the online help.
  841.       - Next to the label FULL_TITLE, type the name you want to assign
  842.         to the help book. This name can contain several words, and is
  843.           used only if you decide to display the help as a "book" on the
  844.         Insight bookshelf.
  845.       - Next to the label VERSION,  type the version number for the product.
  846.       - Next to the label HIDDEN, remove the comment character (#) if you
  847.         want the online help to appear as a book on an Insight bookshelf.
  848.         Change this if you want users to be able to browse the help
  849.         information via Insight, and not just from within your application.
  850.  
  851.     6. Edit the spec file.
  852.  
  853.        - Replace the string ${RELEASE} with the release number for the
  854.          product.  This should match what you've entered in the
  855.          Makefile for the VERSION.
  856.        - Replace the string <ProductName> with a one-word name for
  857.          the product.
  858.        - Replace the string <Shortname> with the TITLE you specified
  859.          in the Makefile. 
  860.        - Replace the string <SHORTNAME> with the TITLE you specified
  861.          in the Makefile. Capitalize all letters.
  862.        - Replace the string <SHORTNAME_HELP> with the TITLE followed by
  863.          by the "_HELP". 
  864.        - Replace the string <Book title> with the FULL_TITLE you 
  865.          specified in the Makefile.
  866.  
  867. Building the Online Help
  868. ------------------------
  869.  
  870. Once you have written the online help, and done the preparation described in
  871. "Preparing to Build the Online Help," you can build and view the online
  872. help. To do so:
  873.  
  874. 1. Go to the directory that contains the online help files.
  875. 2. Type: make help
  876.    If the help is formatted properly, the online help will build and you
  877.    should see these files in the directory: 
  878.  
  879.    If the SGML file contains errors, you will see them displayed in the shell
  880.    window. See "Finding and Correcting Errors" for details.
  881.  
  882. 3. View the book by typing: iiv -b . -v <TITLE>
  883.    Where <TITLE> is the value of TITLE from the Makefile.
  884.  
  885. Finding and Correcting Errors
  886. -----------------------------
  887.  
  888. The SGML tags come in pairs. Each pair contains an opening tag and
  889. a closing tag, and the tag applies to everything between the opening
  890. tag and the closing tag. If you use these tags incorrectly, you will get
  891. error messages while you're building the help file. The most common errors
  892. are the result of misspelled tag names, mismatched end tags, or tags
  893. used out of sequence. 
  894.  
  895. This section lists some sample error messages.
  896.  
  897. SAMPLE 1    
  898.     mkhelperror: not authorized to add tag 'PAR', ignoring content.
  899.  
  900.     This error appears if you specify an invalid tag. In this case,
  901.     the invalid tag is "PAR." The valid tag name is "PARA."
  902.  
  903. SAMPLE 2
  904.     mkhelperror: Start-tag for 'HELPLABEL' is not valid in this context.
  905.     mkhelp  Location:  Line       37 of entity '#DOCUMENT'
  906.     Context:   'hor point for the link
  907.     syntax.</>&#RS;</HelpTopic>&#RS;&#RS;<Helplabel>'...
  908.              '<Anchor Id="AI003">Using Notes, Warnings or Tips Within a P'
  909.          FQGI:      DOCHELP
  910.  
  911.     This error message occurs when the parser sees a tag it isn't
  912.     expecting. In this case it found a HELPLABEL that was not
  913.     preceded by a HELPTOPIC start tag. The error message specifies
  914.     the line number of the error (37), the context in the file,
  915.     and the Fully Qualified Generic Identifier (FQGI) of the
  916.     context. You can probably ignore the FQGI; it describes where
  917.     the error occurs within the SGML structure.
  918.  
  919. SAMPLE 3
  920.     mkhelperror: No 'WARNING' is open, so an end-tag for it is not valid. 
  921.     The last one was closed at line 46.
  922.     mkhelp  Location:  Line       46 of entity '#DOCUMENT'
  923.     Context:   '<warning>Missing open para. This is a warning.</></warning>'...
  924.              '&#RS;<note><para>For your information, this is a note.</></note'
  925.        FQGI:      DOCHELP,DESCRIPTION,PARA,PARA
  926.  
  927.     This message can occur if you close items with the generic
  928.     end tag, </>. In this case, the </> closes the <warning> 
  929.     because the start tag for <para> is missing. This may occur
  930.     if you leave out a start tag or accidentally spell it
  931.     incorrectly.
  932.  
  933. If you want additional information about the errors, use the command
  934. "make verify". It produces a more detailed error log.
  935.  
  936. Producing the Final Product
  937. ----------------------------
  938.  
  939. After you've finished writing and building your online help, you need to
  940. package it so that users can install it with the rest of your product. To
  941. do so:
  942.  
  943. 1. Go to the directory that contains the online help.
  944. 2. Type: make images.
  945.  
  946.    This produces a directory called "images." This directory contains
  947.    all of the files you need to let users install the help with your
  948.    product.  They're prepared so users can install them via "inst,"
  949.    Silicon Graphics' software installation program. If you use a
  950.    different method for installing software, do one of the following.
  951.  
  952.    - If users install your product using the "tar" command, have them
  953.      use tar to copy the online help images as well. After copying the
  954.      images, the user needs to type: inst -af <inst_product>, where
  955.      inst_product is the location of the images.
  956.       
  957.    - If you've created a script, enhance the script so that it extracts
  958.      all of the help images onto disk, and then invokes the command
  959.      "inst -af <inst_product>", where inst_product is the location
  960.      of the images.
  961.  
  962. Bibliography of SGML References
  963. --------------------------------
  964.  
  965. <1>  *SoftQuad, Inc.  The SGML Primer. SoftQuad's Quick Reference
  966.       Guide to the Essentials of the Standard: The SGML Needed for
  967.       Reading a DTD and Marked-up Documents and Discussing them
  968.       Reasonably.  Version 2.0. Toronto: SoftQuad Inc., May 1991.  36
  969.       pages.  Available from SoftQuad Inc.; 56 Aberfoyle Crescent,
  970.       Suite 810; Toronto, Ontario; Canada M8X 2W4; TEL: +1 (416) 239-
  971.       4801; FAX: +1 (416) 239-7105.
  972.  
  973. <2>  Bryan, Martin.  SGML: An Author's Guide to the Standard
  974.       Generalized Markup Language.  Wokingham/Reading/New York:
  975.       Addison-Wesley, 1988.  ISBN: 0-201-17535-5 (pbk);  LC CALL NO:
  976.       QA76.73.S44 B79 1988.  380 pages.  A highly detailed and useful
  977.       manual explaining and illustrating features of ISO 8879.  The
  978.       book: (1) shows how to analyse the inherent structure of a
  979.       document; (2) illustrates a wide variety of markup tags; (3)
  980.       shows how to design your own tag set; (4) is copiously
  981.       illustrated with practical examples; (5) covers the full range
  982.       of SGML features.  Technical and non-technical authors,
  983.       publishers, typesetters and users of desktop publishing systems
  984.       will find this book a valuable tutorial on the use of SGML and a
  985.       comprehensive reference to the standard.  It assumes no prior
  986.       knowledge of computing or typography on the part of its readers.
  987.  
  988. <3>  Goldfarb, Charles F.  The SGML Handbook.  Edited and with a
  989.       foreword by Yuri Rubinsky. Oxford: Oxford University Press,
  990.       1990.  ISBN: 0-19-853737-1.  688 pages.   This volume contains
  991.       the full annotated text of ISO 8879 (with amendments), authored
  992.       by IBM Senior Systems Analyst and acknowledged "father of SGML,"
  993.       Charles Goldfarb.  The book was itself produced from SGML input
  994.       using a DTD which is a variation of the "ISO.general" sample DTD
  995.       included in the annexes to ISO 8879.  The SGML Handbook
  996.       includes: (1) the up-to-date amended full text of ISO 8879,
  997.       extensively annotated, cross-referenced, and indexed (2) a
  998.       detailed structured overview of SGML, covering every concept (3)
  999.       additional tutorial and reference material (4) a unique "push-
  1000.       button access system" that provides paper hypertext links
  1001.       between the standard, annotations, overview, and tutorials.
  1002.  
  1003. <4>  Herwijnen, Eric van.  Practical SGML.  Dordrecht/Hingham, MA:
  1004.       Wolters Kluwer Academic Publishers.  200 pages.  ISBN: 0-7923-
  1005.       0635-X.  The book is designed as a "practical SGML survival-kit
  1006.       for SGML users (especially authors) rather than developers," and
  1007.       itself constitutes an experiment in SGML publishing.  The book
  1008.       provides a practical and painless introduction to the essentials
  1009.       of SGML, and an overview of some SGML applications.  See the
  1010.       reviews by (1) Carol Van Ess-Dykema in Computational Linguistics
  1011.       17/1 (March 1991) 110-116, and (2) Deborah A. Lapeyre in <TAG>
  1012.       16 (October 1990) 12-14.
  1013.  
  1014. <5>  Smith, Joan M.; Stutely, Robert S.  SGML: The Users' Guide to
  1015.       ISO 8879. Chichester/New York: Ellis Horwood/Halsted, 1988. 173
  1016.       pages.  ISBN: 0-7458-0221-4 (Ellis Horwood) and ISBN: 0-470-
  1017.       21126-1 (Halsted).  LC CALL NO: QA76.73.S44 S44 1988.   The book
  1018.       (1) supplies a list of some 200 syntax productions, in numerical
  1019.       and alphabetical sequence; (2) gives a combined abbreviation
  1020.       list; (3) includes highly useful subject indices to ISO 8879 and
  1021.       its annexes (4) supplies graphic representations for the ISO
  1022.       8879 character entities; (5) lists SGML keywords and reserved
  1023.       names.  An overview of the book may be found in the SGML Users'
  1024.       Group Newsletter 9 (August 1988) 9.
  1025.  
  1026. <6>  ISO 8879:1986.  Information Processing -- Text and Office
  1027.       Systems -- Standard Generalized Markup Language (SGML).
  1028.       International Organization for Standardization.  Ref. No. ISO
  1029.       8879:1986 (E). Geneva/New York, 1986.  A subset of SGML became a
  1030.       US FIPS (Federal Information Processing Standard) in 1988.  The
  1031.       British Standards Institution adopted SGML as a national
  1032.       standard (BS 6868) in 1987, and in 1989 SGML was adopted by the
  1033.       CEN/CENELEC Standards Committees as a European standard, #28879.
  1034.       Australia has dual numbered versions of ISO 8879 SGML and ISO
  1035.       9069 SDIF (AS 3514 - SGML 1987; AS 3649 - 1990 SDIF).
  1036.  
  1037.       A one-page NTIS technical note on ISO 8879 as a US FIPS
  1038.       document, FIPS-PUB-152, provides the following abstract for ISO
  1039.       8879:  Abstract "This citation summarizes a one-page
  1040.       announcement of technology available for utilization.  A Federal
  1041.       Information Processing Standard (FIPS) recently approved by the
  1042.       Secretary of Commerce should help federal agencies improve their
  1043.       communications with publishing organizations.  (FIPS are
  1044.       developed by NIST for use by the federal government.)  The new
  1045.       standard, called Standard Generalized Markup Language (SGML),
  1046.       provides a common way for defining markup languages so documents
  1047.       can be transferred from author to publisher in a standardized
  1048.       format.  By providing a coherent and unambiguous syntax for
  1049.       describing the elements within a document, SGML makes it easier
  1050.       to move unformatted textual data among different installations
  1051.       and processing systems.  Developed by the International
  1052.       Organization for Standardization (ISO) and the American National
  1053.       Standards Institute (ANSI) with assistance from NIST, the SGML
  1054.       standard is already being used by the Computer-Aided Acquisition
  1055.       and Logistics Support (CALS) program of the Department of
  1056.       Defense to develop a military specification. NIST is providing
  1057.       technical support for the CALS program.  In addition, NIST has
  1058.       developed the first set of conformance tests for SGML; ISO and
  1059.       ANSI are considering using these tests for their own test
  1060.       suites."  See "Publishing Standard Allows for the Transfer of
  1061.       Documents from Author to Publisher," NTIS Tech Note, 081914000;
  1062.       National Bureau of Standards, Gaithersburg, MD; May 1989.
  1063.  
  1064.       The SGML standard is now (1991) in the process of its first
  1065.       five-year review.  National member bodies of ISO and other
  1066.       entities are submitting revision statements to the ISO/IEC
  1067.       JTC1/SC18/WG8 for review.  See, for example, statements by ANSI
  1068.       X3VI.8 and the SGML Users' Group, printed in the SGML Users'
  1069.       Group Newsletter 20 (September 1991) 20.  For other possible
  1070.       addenda and changes to 8879, see "Recommendations for a Possible
  1071.       Revision of ISO 8879. ISO/IEC JTC1/SC18/WG8 N931 [Part I],"
  1072.       <TAG> 12 (December 1989) 6-8 and "Recommendations for a Possible
  1073.       Revision of ISO 8879. Part II. ISO/IEC JTC1/SC18/WG8 N931,"
  1074.       <TAG> 13 (February 1990) 12-15;  "Additional Recommendations for
  1075.       a Possible Revision of ISO 8879 - Information Processing - Text
  1076.       and Office Systems (ISO/IEC JTC1/SC18/WG8 N1013," <TAG> 15
  1077.       (August, 1990) 12-14.  Balloting of 18 countries' national
  1078.       standards bodies (from 25) based upon review of the standard
  1079.       between November 15, 1990 and February 28, 1991 resulted in
  1080.       general confirmation of ISO 8879, with six requests for
  1081.       revision.  WG8 will continue to review ISO 8879 in light of the
  1082.       comments and recommendations for revision, but the standard is
  1083.       thus confirmed through 1996.  See details in "Replies on Review
  1084.       of ISO 8879 (SGML," EPSIG News 4/4 (December 1991) 8.
  1085.  
  1086. <7>  ISO 8879:1986 / A1:1988 (E). Information Processing -- Text and
  1087.       Office Systems -- Standard Generalized Markup Language (SGML),
  1088.       Amendment 1.  Published 1988-07-01.  Geneva: International
  1089.       Organization for Standardization, 1988.
  1090.